//
//  NotificationManager.swift
//  BasicTools
//
//  Created by ikang on 2025/10/11.
//

import Foundation
import UserNotifications

class NotificationManager: NSObject {
    
    override init() {
        super.init()
        UNUserNotificationCenter.current().delegate = self
    }
    
    func notificationAuth() {
        UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
            if granted {
                
            }else if let error {
                
            }
        }
    }
    
    func isAuth() {
        UNUserNotificationCenter.current().getNotificationSettings { settings in
//            switch settings.authorizationStatus
            
            
//            settings.criticalAlertSetting
            
//            settings.
        }
    }
}

extension NotificationManager: UNUserNotificationCenterDelegate {
    
    func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async -> UNNotificationPresentationOptions {
        // 返回你希望系统在前台展示通知的方式
        return [.banner, .list, .sound]
    }
    
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
        
    }
    
}

